﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace ShakeIt_Server
{
    [DataContract]
    public class _User
    {
        [DataMember]
        private int id { get; set; }
        [DataMember]
        private string username { get; set; }
        [DataMember]
        private string cellPhone { get; set; }

        public _User(User user)
        {
            this.username = user.username;
            this.id = user.id;
            this.cellPhone = user.cellPhone;
        }
    }

    [DataContract]
    public class _Activity
    {
        [DataMember]
        private int id { get; set; }
        [DataMember]
        private string type { get; set; }
        [DataMember]
        private string title { get; set; }
        [DataMember]
        private string detail { get; set; }
        [DataMember]
        private double distance { get; set; }
        [DataMember]
        private string address { get; set; }
        [DataMember]
        private DateTime beginTime { get; set; }
        [DataMember]
        private DateTime endTime { get; set; }
        [DataMember]
        private decimal longitude { get; set; }
        [DataMember]
        private decimal latitude { get; set; }
        [DataMember]
        private _User createUser { get; set; }
        public _Activity(Activity activity)
        {
            this.id = activity.id;
            this.type = activity.type;
            this.detail = activity.detail;
            this.title = activity.title;
            this.address = activity.address;
            this.beginTime = activity.beginTime;
            this.endTime = activity.endTime;
            this.longitude = activity.longitude;
            this.latitude = activity.latitude;
            this.createUser = new _User(activity.User);
        }
        public _Activity(Activity activity,double distance)
        {
            this.id = activity.id;
            this.type = activity.type;
            this.detail = activity.detail;
            this.title = activity.title;
            this.address = activity.address;
            this.distance = distance;
            this.beginTime = activity.beginTime;
            this.endTime = activity.endTime;
            this.longitude = activity.longitude;
            this.latitude = activity.latitude;
            this.createUser = new _User(activity.User);
        }
    }

    [DataContract]
    public class _UserComment
    {
        [DataMember]
        private int id { get; set; }
        [DataMember]
        private int score { get; set; }
        [DataMember]
        private DateTime time { get; set; }
        [DataMember]
        private string commentContent { get; set; }
        [DataMember]
        private string user { get; set; }
        [DataMember]
        private string commenter { get; set; }
        public _UserComment(UserComment uc)
        {
            this.id = uc.id;
            this.score = uc.score;
            this.time = uc.time;
            this.commentContent = uc.commentContent;
            this.user = uc.User.username;
            this.commenter = uc.User1.username;
        }
    }

    [DataContract]
    public class _Chat
    {
        [DataMember]
        private int id { get; set; }
        [DataMember]
        private string chatContent { get; set; }
        [DataMember]
        private DateTime sendTime { get; set; }
        [DataMember]
        private _User sendMember { get; set; }
        [DataMember]
        private _User receiveMember { get; set; }
        [DataMember]
        private bool arrive { get; set; }

        public _Chat(Chat c)
        {
            this.id = c.id;
            this.chatContent = c.chatContent;
            this.sendTime = c.sendTime;
            this.sendMember = new _User(c.User);
            this.receiveMember = new _User(c.User1);
            this.arrive = c.arrive;
        }
    }
}